home *** CD-ROM | disk | FTP | other *** search
/ Delphi Developer's Kit 1996 / Delphi Developer's Kit 1996.iso / power / novtli / tiuser.pas < prev    next >
Pascal/Delphi Source File  |  1995-12-22  |  10KB  |  381 lines

  1. unit Tiuser;
  2.  
  3. interface
  4.  
  5. uses
  6.   tispxipx;
  7.  
  8. const
  9.   O_NDELAY   =   $4000;
  10.   O_NONBLOCK =   O_NDELAY;
  11.   O_RDWR = $02;
  12.   EAGAIN     =   -1;
  13.  
  14.   { Error values }
  15.  
  16.   TBADADDR     =   1;
  17.   TBADOPT      =   2;
  18.   TACCES       =   3;
  19.   TBADF        =   4;
  20.   TNOADDR      =   5;
  21.   TOUTSTATE    =   6;
  22.   TBADSEQ      =   7;
  23.   TSYSERR      =   8;
  24.   TLOOK        =   9;
  25.   TBADDATA     =  10;
  26.   TBUFOVFLW    =  11;
  27.   TFLOW        =  12;
  28.   TNODATA      =  13;
  29.   TNODIS       =  14;
  30.   TNOUDERR     =  15;
  31.   TBADFLAG     =  16;
  32.   TNOREL       =  17;
  33.   TNOTSUPPORT  =  18;
  34.   TSTATECHNG   =  19;
  35.   TNOSTRUCTYPE =  20;
  36.   TBADNAME     =  21;
  37.   TBADQLEN     =  22;
  38.   TADDRBUSY    =  23;
  39.  
  40.   { t_look events }
  41.  
  42.   C_T_LISTEN     = $0001;
  43.   C_T_CONNECT    = $0002;
  44.   C_T_DATA       = $0004;
  45.   C_T_EXDATA     = $0008;
  46.   C_T_DISCONNECT = $0010;
  47.   C_T_UDERR      = $0040;
  48.   C_T_ORDREL     = $0080;
  49.   C_T_GODATA     = $0100;
  50.   C_T_GOEXDATA   = $0200;
  51.   C_T_EVENTS     = $0400;
  52.   C_T_ERROR      = $0500;   { Netware.tli specific t_look event }
  53.  
  54.   { Flag definitions }
  55.  
  56.   T_MORE        = $01;
  57.   T_EXPEDITED   = $02;
  58.   T_NEGOTIATE   = $04;
  59.   T_CHECK       = $08;
  60.   T_DEFAULT     = $10;
  61.   T_SUCCESS     = $20;
  62.   T_FAILURE     = $40;
  63.  
  64.   {   T_event flag values }
  65.  
  66.   T_DISABLE     = 0;
  67.   T_ENABLE      = 1;
  68.   T_SAME        = 2;
  69.  
  70.  
  71. { Service types }
  72.  
  73.   T_COTS       = 01;    { Connection-mode service }
  74.   T_COTS_ORD   = 02;    { Connection service with orderly release }
  75.   T_CLTS       = 03;    { Connectionless-mode service }
  76.  
  77. { t_alloc structure types }
  78.  
  79.   T_BIND_STR     =  1;
  80.   T_OPTMGMT_STR  =  2;
  81.   T_CALL_STR     =  3;
  82.   T_DIS_STR      =  4;
  83.   T_UNITDATA_STR =  5;
  84.   T_UDERROR_STR  =  6;
  85.   T_INFO_STR     =  7;
  86.  
  87.   { t_alloc field identifiers }
  88.  
  89.   T_ADDR  = $01;
  90.   T_OPT   = $02;
  91.   T_UDATA = $04;
  92.  
  93.   T_ALL   = $08;  { modified to suit netware.tli }
  94.  
  95.   { redefine t_alloc types to suit AT&T specs }
  96.  
  97.   C_T_BIND     = T_BIND_STR;
  98.   C_T_CALL     = T_CALL_STR;
  99.   C_T_OPTMGMT  = T_OPTMGMT_STR;
  100.   C_T_DIS      = T_DIS_STR;
  101.   C_T_UNITDATA = T_UNITDATA_STR;
  102.   C_T_UDERROR  = T_UDERROR_STR;
  103.   C_T_INFO     = T_INFO_STR;
  104.  
  105.  
  106.   { State values }
  107.  
  108.   C_T_UNINIT   =  0;    {* added to match xti state tables *}
  109.   C_T_UNBND    =  1;    {* unbound *}
  110.   C_T_IDLE     =  2;    {* idle *}
  111.   C_T_OUTCON   =  3;    {* outgoing connection pending *}
  112.   C_T_INCON    =  4;    {* incoming connection pending *}
  113.   C_T_DATAXFER =  5;    {* data transfer *}
  114.   C_T_OUTREL   =  6;    {* outgoing orderly release *}
  115.   C_T_INREL    =  7;    {* incoming orderly release *}
  116.  
  117.   { general purpose defines }
  118.   T_YES     =  1;
  119.   T_NO      =  0;
  120.   T_UNUSED  = -1;
  121.   T_NULL    =  0;
  122.   T_ABSREQ  =  $8000;
  123.  
  124.   { ------------------------OSI specific Options-------------------------}
  125.  
  126.   { ISO definitions }
  127.  
  128.   T_CLASS0  =  0;
  129.   T_CLASS1  =  1;
  130.   T_CLASS2  =  2;
  131.   T_CLASS3  =  3;
  132.   T_CLASS4  =  4;
  133.  
  134.   { priorities }
  135.  
  136.   T_PRITOP  = 0;
  137.   T_PRIHIGH = 1;
  138.   T_PRIMID  = 2;
  139.   T_PRILOW  = 3;
  140.   T_PRIDFLT = 4;
  141.  
  142.   { protection levels }
  143.  
  144.   T_NOPROTECT      = 1;
  145.   T_PASSIVEPROTECT = 2;
  146.   T_ACTIVEPROTECT  = 4;
  147.  
  148.   { default value for the length of TPDU's }
  149.  
  150.   T_LTPDUDFLT   = 128;
  151.  
  152.  
  153.   {---------------------TCP specific Options--------------------------}
  154.  
  155.   { TCP Precedence Levels }
  156.  
  157.   T_ROUTINE       = 0;
  158.   T_PRIORITY      = 1;
  159.   T_IMMEDIATE     = 2;
  160.   T_FLASH         = 3;
  161.   T_OVERRIDEFLASH = 4;
  162.   T_CRITIC_ECP    = 5;
  163.   T_INETCONTROL   = 6;
  164.   T_NETCONTROL    = 7;
  165.  
  166.  
  167.  
  168. type
  169.  
  170.   t_infoREC = record
  171.     addr: longint;
  172.     options: longint;
  173.     tsdu: longint;
  174.     etsdu: longint;
  175.     connect: longint;
  176.     discon: longint;
  177.     servtype: longint;
  178.   end;
  179.   Pt_infoREC = ^t_infoREC;
  180.  
  181.   netbufREC = record
  182.     maxlen: word;
  183.     len: word;
  184.     buf: PChar;
  185.   end;
  186.   PnetbufREC = ^netbufREC;
  187.  
  188.   t_bindREC = record
  189.     addr: netbufREC;
  190.     qlen: word;
  191.   end;
  192.   Pt_bindREC = ^t_bindREC;
  193.  
  194.   t_optmgmtREC = record
  195.     opt: netbufREC;
  196.     flags: longint;
  197.   end;
  198.   Pt_optmgmtREC = ^t_optmgmtREC;
  199.  
  200.   t_disconREC = record
  201.     udata: netbufREC;
  202.     reason: integer;
  203.     sequence: integer;
  204.   end;
  205.   Pt_disconREC = ^t_disconREC;
  206.  
  207.   t_callREC  = record
  208.     addr: netbufREC;
  209.     opt: netbufREC;
  210.     udata: netbufREC;
  211.     sequence: integer;
  212.   end;
  213.   Pt_callREC = ^t_callREC;
  214.  
  215.   t_unitdataREC = record
  216.     addr: netbufREC;
  217.     opt: netbufREC;
  218.     udata: netbufREC;
  219.   end;
  220.   Pt_unitdataREC = ^t_unitdataREC;
  221.  
  222.   t_uderrREC = record
  223.     addr: netbufREC;
  224.     opt: netbufREC;
  225.     error: integer;
  226.   end;
  227.   Pt_uderrREC = ^t_uderrREC;
  228.  
  229.   { rate structure }
  230.  
  231.   rateREC = record
  232.     targetvalue: longint;
  233.     minacceptvalue: longint;
  234.   end;
  235.   PrateREC = ^rateREC;
  236.  
  237.   { reqvalue structure }
  238.  
  239.   reqvalueREC = record
  240.     called: rateREC;
  241.     calling: rateREC;
  242.   end;
  243.   PreqvalueREC = ^reqvalueREC;
  244.  
  245.   { throughput structure }
  246.  
  247.   thrptREC  = record
  248.     maxthrpt: reqvalueREC;
  249.     avgthrpt: reqvalueREC;
  250.   end;
  251.   PthrptREC = ^thrptREC;
  252.  
  253.   { management structure }
  254.  
  255.   managementREC  = record
  256.     dflt: shortint;     { T_YES to use default values or T_NO to use values in structure }
  257.     ltpdu: integer;     { maximum length of TPDU }
  258.     reastime: shortint; { reassignment time (in seconds) }
  259.     prefclass: char;    {* preferred class *}
  260.     altclass: char;     { alternative class }
  261.     extform: char;      { extended format: T_YES or T_NO }
  262.     flowctrl: char;     { flow control: T_YES or T_NO }
  263.     checksum: char;
  264.     netexp: char;       { network expedited data }
  265.     netrecptcf: char;   { receipt confirmation }
  266.   end;
  267.   PmanagementREC = ^managementREC;
  268.  
  269.   { ISO connection-oriented options }
  270.  
  271.   isoco_optionsREC = record
  272.     throughput: thrptREC;
  273.     transdel: reqvalueREC;       {* transit delay *}
  274.     reserrorrate: rateREC;       { residual error rate }
  275.     transffailprob: rateREC;     { transfer failure problem }
  276.     estfailprob: rateREC;        { connection establishment failure problem }
  277.     relfailprob: rateREC;        { connection release failure problem }
  278.     estdelay: rateREC;           { connection establishment delay }
  279.     reldelay: rateREC;           { connection release delay }
  280.     connresil: netbufREC;        { connection resilience }
  281.     protection: shortint;
  282.     priority: shortint;
  283.     mngmt: managementREC;        { management parameters }
  284.     expd: char;               { expedited data: T_YES or T_NO }
  285.   end;
  286.   Pisoco_optionsREC = ^isoco_optionsREC;
  287.  
  288.   { ISO connectionless options }
  289.  
  290.   isocl_optionsREC = record
  291.     transdel: rateREC;     { transit delay }
  292.     reserrorrate: rateREC; { residual error rate }
  293.     protection: shortint;
  294.     priority: shortint;
  295.   end;
  296.   Pisocl_optionsREC = ^isocl_optionsREC;
  297.  
  298.   { TCP security options structure }
  299.  
  300.   secoptionsREC  = record
  301.     security: shortint;
  302.     compartment: shortint;
  303.     handling: shortint;    { handling restrictions }
  304.     tcc: longint;          { transmission control code }
  305.   end;
  306.   PsecoptionsREC = ^secoptionsREC;
  307.  
  308.   { TCP options }
  309.  
  310.   tcp_optionsREC = record
  311.     precedence: shortint;
  312.     timeout: longint;       { abort timeout }
  313.     max_seg_size: longint;
  314.     secopt: secoptionsREC;     { security options }
  315.   end;
  316.   Ptcp_optionsREC = ^tcp_optionsREC;
  317.  
  318.   Pint = ^integer;    { for t_errno }
  319.  
  320. function t_accept(fd: integer; resfd: integer; call: Pt_callREC ) : integer;
  321. function t_alloc(fd: integer; struct_type: integer; fields: integer) : PChar;
  322. function t_bind(fd: integer; req: Pt_bindREC; ret: Pt_bindREC ) : integer;
  323. function t_blocking(fd: integer) : integer;
  324. function t_close(fd: integer) : integer;
  325. function t_connect(fd: integer; sndcall: Pt_callREC; rcvcall: Pt_callREC) : integer;
  326. function t_errno: Pint;
  327. procedure t_error (errmsg: PChar);
  328. function t_free(ptr: PChar; struct_type: integer) : integer;
  329. function t_getinfo(fd: integer; info: Pt_infoREC) : integer;
  330. function t_getstate(fd: integer) : integer;
  331. function t_listen(fd: integer; call: Pt_callREC) : integer;
  332. function t_look (fd: integer) : integer;
  333. function t_nonblocking(fd: integer) : integer;
  334. function  t_open(path: PChar; oflag: integer; info: Pt_infoREC) : integer;
  335. function t_optmgmt(fd: integer; req: Pt_optmgmtREC; ret: Pt_optmgmtREC) : integer;
  336. function t_rcv (fd: integer; buf: PChar; nbytes: Word; var flags: integer) : integer;
  337. function t_rcvconnect(fd: integer; call: Pt_callREC) : integer;
  338. function t_rcvdis(fd: integer; discon: Pt_disconREC) : integer;
  339. function t_rcvrel(fd: integer) : integer;
  340. function t_rcvudata(fd: integer; unitdata: Pt_unitdataREC; var flags: integer ) : integer;
  341. function t_rcvuderr(fd: integer; uderr: Pt_uderrREC) : integer;
  342. function t_snd(fd: integer; buf: PChar; nbytes: word; flags: integer) : integer;
  343. function t_snddis(fd: integer; call: Pt_callREC) : integer;
  344. function t_sndrel(fd: integer) : integer;
  345. function t_sndudata(fd: integer; unitdata: Pt_unitdataREC) : integer;
  346. function t_sync(fd: integer) : integer;
  347. function t_unbind(fd: integer) : integer;
  348.  
  349. implementation
  350.  
  351. function t_accept; external 'tli_win';
  352. function t_alloc; external 'tli_win';
  353. function t_bind; external 'tli_win';
  354. function t_blocking; external 'tli_win';
  355. function t_close; external 'tli_win';
  356. function t_connect; external 'tli_win';
  357. function t_errno; external 'tli_win' name 'terrno_func';
  358. procedure t_error; external 'tli_win';
  359. function t_free; external 'tli_win';
  360. function t_getinfo; external 'tli_win';
  361. function t_getstate; external 'tli_win';
  362. function t_listen; external 'tli_win';
  363. function t_look; external 'tli_win';
  364. function t_nonblocking; external 'tli_win';
  365. function  t_open; external 'tli_win';
  366. function t_optmgmt; external 'tli_win';
  367. function t_rcv; external 'tli_win';
  368. function t_rcvconnect; external 'tli_win';
  369. function t_rcvdis; external 'tli_win';
  370. function t_rcvrel; external 'tli_win';
  371. function t_rcvudata; external 'tli_win';
  372. function t_rcvuderr; external 'tli_win';
  373. function t_snd; external 'tli_win';
  374. function t_snddis; external 'tli_win';
  375. function t_sndrel; external 'tli_win';
  376. function t_sndudata; external 'tli_win';
  377. function t_sync; external 'tli_win';
  378. function t_unbind; external 'tli_win';
  379.  
  380. end.
  381.